package com.dyylearn.http.servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

//这里我们把doGet和doPost合并处理
public class T1Servlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // 如果有一个请求来
        // 重定向到hi.html
        //（1）返回302状态码（2）响应买Location：/hi.html
//        resp.sendRedirect("/http/hi.html");
        resp.sendRedirect("/http/hi.html");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }
}
